﻿namespace AutoRevit.Event;

/// <summary>
/// 外部命令执行处理器
/// </summary>
/// <param name="uiapp"></param>
public delegate void ExecuteHandler(UIApplication uiapp);

/// <summary>
/// 外部命令执行错误处理器
/// </summary>
/// <param name="uiapp"></param>
/// <param name="exception"></param>
public delegate void ExecuteExceptionHandler(UIApplication uiapp, Exception exception);

/// <summary>
/// 扩展功能外部事件处理
/// </summary>
public interface IExtensionsExternalEventHandler
{
    /// <summary>
    /// 外部命令执行时事件
    /// </summary>
    event ExecuteHandler OnExecutein;

    /// <summary>
    /// 外部命令执行后事件
    /// </summary>
    event ExecuteHandler OnExecuteed;

    /// <summary>
    /// 外部事件执行错误事件
    /// </summary>
    event ExecuteExceptionHandler OnException;

    /// <summary>
    /// 外部命令执行
    /// </summary>
    /// <param name="handlerInfo"></param>
    void Execute(ExternalEventHandlerInfo handlerInfo);

    /// <summary>
    /// 执行外部事件
    /// </summary>
    /// <param name="action"></param>
    void Execute(Action<UIApplication> action);
}
